1. Field of Invention
The present invention relates to an image processing method, and more particularly to an image processing method of locating and capturing a plurality of barcode areas in an image frame.
2. Related Art
By executing a barcode recognition program, a common data processing device can capture and recognize a barcode to be recognized through a built-in or external camera to acquire barcode information.
FIG. 1 shows a sample image frame 1 having a barcode. In a recognition method adopted in current recognition program, it is to define a horizontal line 2 at the center of the sample image frame 1, such that the horizontal line passes through all the bar blocks forming the barcode. Next, the data processing device that executes the barcode recognition program acquires pixels on the horizontal line 2 along the aforementioned horizontal line 2 one by one. Subsequently, the data processing device calculates gray level values of all pixels (the common formula for calculating the gray level value is: Gray level=0.299R+0.587G+0.144B), thereby finding a central point of the barcode area. And then the data processing device searches for the boundaries in the left and right. After the boundaries are determined, the barcode area in the sample image frame may be determined, and a Binarization process is performed on the barcode area, thereby further recognizing the barcode information.
This method is simple, but a single scan track may easily cause misjudgment of the barcode area, which causes that the data processing device cannot really find the barcode area, or that the area without the barcode is misjudged as the barcode area, which causes inconveniences to the user. Furthermore, when the sample image frame is acquired, the user has to keep the aforementioned horizontal line to pass through the barcode, and thus completing the barcode recognition. On the printing medium with multiple barcodes, one sample image frame has to be acquired for each barcode, thus recognizing each barcode individually through the aforementioned horizontal line.
As shown in FIG. 2, in another method adopted in the recognition program, an entire sample image frame is processed. The data processing device that executes the recognition program first calculates the gray level value of each pixel, then the data processing device enhances black and white contrast of the sample image frame by using a variety of filters, for example, a Medium Filter. Finally the data processing device uses various masks, for example, a Sobel mask to locate the barcode area. FIG. 2 is a partial enlarged view of a sample image frame processed by a filter. In FIG. 2, the black and white contrast between pixels forming the barcode and the pixels without the barcode is enhanced, thus forming high contrast. Finally, the data processing device may find out the barcode area in the processed sample image frame, thereby recognizing the barcode.
This method is not only applied in the barcode recognition but also applied in other image recognition purposes (for example, car license plate recognition). Since the entire image frame is analyzed in the method, in the situation that an image has multiple barcodes, the data processing device may also find the barcodes one by one, and recognizes the barcodes respectively. However, according to the aforementioned method, all pixels of the sample image frame have to be responsibly processed, which costs a large amount of hardware resources. To a handheld data processing device with relatively low hardware performance, this method requires considerable operation time.